package cn.kgc.api.entity;

import java.util.Date;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonFormat;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "users")
@SuppressWarnings("serial")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class Users extends Model<Users> implements Serializable {


    /**
     * id
     */
    @TableId(value = "user_id", type = IdType.AUTO)
    private String userId;

    /**
     * 名字
     */
    @TableField(value = "user_name")
    private String userName;

    /**
     * 密码
     */
    @TableField(value = "user_pwd")
    private String userPwd;


    /**
     * 邮箱
     */
    @TableField(value = "user_email")
    private String userEmail;


    /**
     * 手机号
     */
    @TableField(value = "mobile")
    private String mobile;


    /**
     * 性别(0男 1女)
     */
    @TableField(value = "sex")
    private Integer sex;


    /**
     * 部门id
     */
    @TableField(value = "dept_id")
    private Integer deptId;


    /**
     * 工作
     */
    @TableField(value = "job")
    private String job;


    /**
     * 状态(1在职 2离职 3试用期)
     */
    @TableField(value = "state")
    private Integer state;



    /**
     * 角色ID
     */
    @TableField(value = "role_id")
    private Integer roleId;


    @Version
    private int version;

    /**
     * 创建时间
     */
    @TableField(value = "creationDate", fill = FieldFill.INSERT)
    @JsonIgnore
    private Date creationDate;


    /**
     * 最近一次登录时间
     */
    @TableField(value = "last_login_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastLoginTime;

    @TableField(exist = false)
    private String roleName;

    @TableField(exist = false)
    private String deptName;

}
